﻿#ifndef FORMATCONTROLLER_H
#define FORMATCONTROLLER_H

#include <QObject>
#include "editorwidget.h"
#include "itoolbar.h"
#include "iformatpanel.h"
#include "ribbontoolbar.h"
#include "menubar.h"

struct FormatStyle;

class FormatController : public QObject
{
	Q_OBJECT
public:
	explicit FormatController(QObject* parent = nullptr);


	void setRibbonToolbar(IToolbar* ribbon);
	void setFormatPanel(IFormatPanel* formatPanel);
	void setActiveEditor(EditorWidget* editor);
	void setMenuBar(MenuBar* menubar);
	
	void initConnections();

public slots:
	void onEditorFormat
	(
		bool isBold, bool isItalic, bool isUnderline, bool isStrikethrough,
		const QString& fontFamily, int fontSize, const QColor& fontcolor,
		const QColor& highlightcolor,
		Qt::Alignment alignment, const QString& styleMarker
	);

	void onSidebarStyleSelected(const QString& styleName);
	void onMenubarStyleSelected(const QString& styleName);
	void onRibbonStyleSelected(const QString& styleName);
	void disconnectEditorSignals(EditorWidget* editor);
signals:


private:
	void connectEditorSignals(EditorWidget* editor);
	IToolbar* m_ribbon = nullptr;
	IFormatPanel* m_panel = nullptr;
	EditorWidget* m_editor = nullptr;
	MenuBar* m_menubar = nullptr;
};

#endif // FORMATCONTROLLER_H